package _interview150;

import _object.ListNode;

/**
 * 141. 环形链表
 */
public class No141 {
    public boolean hasCycle(ListNode head) {
        if (head == null || head.next == null) return false;
        ListNode slow = head, fast = head.next;
        while (fast != null && fast.next != null && slow != fast) {
            slow = slow.next;
            fast = fast.next.next;
        }
        return fast == slow;
    }
}
